Welcome

It’s good to have you join our class. We are excited that you are taking this bold step to start your journey to learn R! Let’s get started!

Getting started

How to install R and RStudio

To get yourself ready to start a journey learning r programming, you need to get a computer system that has R installed on it and an IDE that makes learning easy and fun like RStudio. You can get this done by following this steps in order:

  1. Install R Download R for Mac by opening this link mac or this link for windows. The links would open a web page showing you how to download the appropriate files right for your computer’s operating system. Install R by double-clicking the downloaded and follow ths simple promts and default selected options to complete your installation. When you are done with this installation, follow the next step below.

  2. Install RStudio IDE Click this link rstudio IDE to download the installation file. Scroll down the web page to click the button for the RStudio FREE download option.

Download landing page Scroll down to download option
fig-1 RStudio download page fig-2 RStudio download page

By clicking the button, you are taken to a page which automatically detects your operating system and display the right file for you to download.

fig-3 Example RStudio for Mac
fig-3 Example RStudio for Mac


Double-click the downloaded file and follow the prompt to install your IDE. That’s it!

RStudio cloud

RStudio Cloud is another product from rstudio which gives you a lightweight, cloud-based version of RStudio Desktop IDE that allows you work with your r scripts, projects online and also share with your colleagues.


Fig-4 RStudio IDE cloud
Fig-4 RStudio IDE cloud


Customize your RStudio IDE

RStudio IDE provides options for you to customize your working enviroment to suit your personality. These options are accessible from the Options dialog via Tools > Options menu. Let’s take a walkthrough in the RStudio IDE to do the customization together.

RStudio IDE Panes

fig-5 RStudio IDE Panes
fig-5 RStudio IDE Panes


Files and Project structure in RStudio


Set and get working directory

# insert your directory location or address into the double quotation mark
setwd("images/alison/")

# get and display working directory location or address
getwd()
## [1] "C:/Users/Gk Coordinator/Desktop/r-projects/intro-to-R/images/alison"


Getting help and resources

?janitor
## No documentation for 'janitor' in specified packages and libraries:
## you could try '??janitor'


Install and load packages in R

What is a package?

# installing a single package with base R
# install.packages("pacman")

# installing multiple packages with base R
# install.packages(c("tidyverse", "xlsx", "lubridate", "skimr", "janitor", "rmarkdown", "rio", "here"))


# Installing (if necessary) and load packages using pacman package
# pacman::p_load(tidyverse, lubridate, xlsx, skimr, janitor, rmarkdown, rio, here)


You are ready to begin writing your first code!


Thank you!